"use strict"

function onLogin()
{

}

async function Refresh()
{
    $.ajax({
        url: Helper.GetServerIP() + "/analytics",
                  dataType: "text",
                  type: "post",
                  data: { address:Helper.addressCur },
                  success: async function (data) {
                    var json = JSON.parse(data);

                    // var contractGamingLP = GetContractGamingLP();
                    // var totalSupply = await contractGamingLP.totalSupplyToken();
                    // totalSupply = Helper.Fix2(window._ethers.utils.formatUnits(totalSupply, Contract_Decimals))
                    // $("#Assets-Under-Management").html("$"+totalSupply);
                
                    // var _TradingTotal = await contractGamingLP._TradingTotal();
                    // _TradingTotal = Helper.Fix2(window._ethers.utils.formatUnits(_TradingTotal, Contract_Decimals))
                    // $("#Total-Trading-Volume").html("$"+_TradingTotal);
                
                    // var _LPFeeTotal = await contractGamingLP._LPFeeTotal();
                    // _LPFeeTotal = Helper.Fix2(window._ethers.utils.formatUnits(_LPFeeTotal, Contract_Decimals))
                    // $("#Accrued-Fees").html("$"+ _LPFeeTotal);

                    $("#Assets-Under-Management").html( Helper.Fix4(json.Assets_Under_Management) );
                    $("#Total-Trading-Volume").html( Helper.Fix4(json.Total_rading_Volume) );
                    $("#Accrued-Fees").html( Helper.Fix4(json.Accrued_Fees) );
                    $("#Total-Users").html( json.Total_Users );
                    $("#PlayerBet24H").html( Helper.Fix4(json.PlayerBet24H) );

                    // $("#Assets-Under-Management-24").html( "$"+ Helper.Fix2( Helper.Sub(totalSupply,json.Assets)) );
                    // $("#Total-Trading-Volume-24").html( "$"+ Helper.Fix2( Helper.Sub(_TradingTotal,json.Trading)) );
                    // $("#Accrued-Fees-24").html( "$"+ Helper.Fix2( Helper.Sub(_LPFeeTotal,json.Fees)) );
                    // $("#Total-Users-24").html( Helper.Fix2( Helper.Sub(json.Users_CUR,json.Users)) );

                  },
                  error: function (err) {
                    console.log(err);
                  }
    });

}

(function($) {
    "use strict"

    Refresh();
    

})(jQuery);


